package com.retrozelda.nyanimals;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;

/// main game class
public class CGameActivity extends Activity
{
	// tag
	private static final String		TAG	= CGameActivity.class.getSimpleName();

	private NyanimalGLSurfaceView	m_glSurface;								// render
																				// thread

	// private NyanimalUpdateThread m_updateThread; // update thread
	// private CNyanimalGame m_game; // the main game class

	public CGameActivity()
	{
	}

	/*
	 * public CNyanimalGame GetGame() { return m_updateThread.GetGame(); }
	 */
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		Log.d(TAG, "Create Start");
		super.onCreate(savedInstanceState);

		// turn off stuff
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
	    		WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);


		// make full screen
		// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
		// WindowManager.LayoutParams.FLAG_FULLSCREEN);

		// init openGL
		m_glSurface = new NyanimalGLSurfaceView(this);// , size.x, size.y);

		// set the game panel
		setContentView(m_glSurface);

		// init the game
		// m_game.Init(this);
		// m_updateThread = new NyanimalUpdateThread();
		Log.d(TAG, "Create End");
	}

	@Override
	protected void onStart()
	{
		Log.d(TAG, "Start Start");
		super.onStart();
		// m_updateThread.setGame(m_game);
		// m_updateThread.setRunning(true);
		// m_updateThread.start();
		Log.d(TAG, "Start End");
	}

	@Override
	protected void onStop()
	{
		Log.d(TAG, "Stop Start");
		super.onStop();
		// m_game = m_updateThread.GetGame();
		// m_updateThread.setRunning(false);
		// m_updateThread.stop();
		Log.d(TAG, "Stop End");
	}
	
	@Override
	protected void onDestroy()
	{
		Log.d(TAG, "Destroy Start");
		super.onDestroy();
		System.runFinalizersOnExit(true);
		Log.d(TAG, "Destroy End");
	}

	@Override
	protected void onPause()
	{
		Log.d(TAG, "Pause Start");
		super.onPause();
		m_glSurface.onPause();
		Log.d(TAG, "Pause End");
	}

	@Override
	protected void onResume()
	{
		Log.d(TAG, "Resume Start");
		super.onResume();
		m_glSurface.onResume();

		Log.d(TAG, "Resume End");
	}
}
